#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import os
import time

print(os.getcwd())

os.chdir(r"C:\Users\xiong\Desktop\py练习\刷博客")
print(os.getcwd())

"""
print(os.curdir)
print(os.pardir)
# os.makedirs("a/a")
# os.removedirs("a/a")

# os.mkdir("abc")
# os.rmdir("abc")

print(os.listdir(os.getcwd()))
# print(os.remove("a.txt"))
get_ctime = os.stat("02-函数/01-自定义函数.py").st_ctime
print(time.strftime("%Y-%m-%d %X", time.localtime(get_ctime)))

print(os.sep)
print(os.linesep)
print(os.pathsep)
print(os.name)
# print(os.system("dir"))
print(os.environ)
"""


print(os.path.abspath(__file__))
print(os.path.split(r"C:\Users\xiong\Desktop\py练习\刷博客\模块\04-os.py"))
print(os.path.dirname(__file__))
print(os.path.basename(__file__))
print(os.path.exists(r"C:/Users/xiong/Desktop/py练习/刷博客/03-模块/xx"))
print(os.path.isfile(r"C:/Users/xiong/Desktop/py练习/刷博客/03-模块/01-time.py"))
print(os.path.isdir(r"C:/Users/xiong/Desktop/py练习/刷博客/03-模块"))
print(os.path.join(r"C:/Users/xiong/Desktop/py练习/刷博客/03-模块",r"C:/Users/xiong/Desktop/刷博客"))
print(os.path.getatime(r"C:/Users/xiong/Desktop/py练习/刷博客/03-模块/01-time.py"))
# 相当于是 os.stat(r"C:/Users/xiong/Desktop/py练习/刷博客/03-模块/01-time.py").st_atime


print(os.path.normcase('c:/windows\\system32\\'))           # c:\windows\system32\

# 规范化路径，如..和/
print(os.path.normpath('c://windows\\System32\\../Temp/'))  # c:\windows\Temp
a='/Users/jieli/test1/\\\\a1/\\\\aa.py/../..'
print(os.path.normpath(a))     # \Users\jieli\test1\a1

a='/Users/jieli/test1/\\\\a1/\\\\aa.py/..'
print(os.path.normpath(a))     # \Users\jieli\test1

